package com.example.myapplication2;

import android.content.ContentValues;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class clientActivity extends AppCompatActivity implements View.OnClickListener {

    private TextView nameEdit6;
    private TextView heightEdit6;
    private TextView idEdit4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_client);
        nameEdit6 = findViewById(R.id.nameEdit6);
        heightEdit6 = findViewById(R.id.heightEdit6);
        idEdit4 = findViewById(R.id.IdEdit4);
        findViewById(R.id.dataBaseAdd4).setOnClickListener(this);
        findViewById(R.id.dataBaseUpdate4).setOnClickListener(this);
        findViewById(R.id.dataBaseDelete4).setOnClickListener(this);
        findViewById(R.id.dataBaseQuery4).setOnClickListener(this);
        findViewById(R.id.dataBaseQueryAll4).setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        Uri uri=Uri.parse("content://com.example.myapplication2.ContentProvider.BookContentProvider");
        switch (view.getId()) {
            case R.id.dataBaseAdd4:

                ContentValues values=new ContentValues();
                values.put("name","传递参数");

                getContentResolver().insert(uri,values);
                break;
            case R.id.dataBaseUpdate4:

                ContentValues values2=new ContentValues();
                int update = getContentResolver().update(uri,values2,null,null);
                Log.d("info",update+"");
                break;
            case R.id.dataBaseDelete4:
                int delete = getContentResolver().delete(uri, null, null);
                Log.d("info",delete+"");
                break;
            case R.id.dataBaseQuery4:
                break;
            case R.id.dataBaseQueryAll4:
                break;
        }
    }
}